package ctn.hibernate.po;

// Generated 2011-12-8 2:29:36 by Hibernate Tools 3.2.4.GA

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


/**
 * CtnUserMsg generated by hbm2java
 */
@Entity
@Table(name = "ctn_user_msg", catalog = "cpa")
public class CtnUserMsg implements java.io.Serializable {

	private Long id;
	private CtnUser ctnUser;
	private CtnMsgTempl ctnMsgTempl;
	private Long sendUserId;
	private Date sendDate;
	private String status;
	private Set<CtnUserMsgParm> ctnUserMsgParms = new HashSet<CtnUserMsgParm>(0);

	public CtnUserMsg() {
	}

	public CtnUserMsg(Long id, CtnUser ctnUser, CtnMsgTempl ctnMsgTempl,
			Long sendUserId, Date sendDate, String status) {
		this.id = id;
		this.ctnUser = ctnUser;
		this.ctnMsgTempl = ctnMsgTempl;
		this.sendUserId = sendUserId;
		this.sendDate = sendDate;
		this.status = status;
	}

	public CtnUserMsg(Long id, CtnUser ctnUser, CtnMsgTempl ctnMsgTempl,
			Long sendUserId, Date sendDate, String status,
			Set<CtnUserMsgParm> ctnUserMsgParms) {
		this.id = id;
		this.ctnUser = ctnUser;
		this.ctnMsgTempl = ctnMsgTempl;
		this.sendUserId = sendUserId;
		this.sendDate = sendDate;
		this.status = status;
		this.ctnUserMsgParms = ctnUserMsgParms;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "USER_ID", nullable = false)
	public CtnUser getCtnUser() {
		return this.ctnUser;
	}

	public void setCtnUser(CtnUser ctnUser) {
		this.ctnUser = ctnUser;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "MSG_TEMPL_ID", nullable = false)
	public CtnMsgTempl getCtnMsgTempl() {
		return this.ctnMsgTempl;
	}

	public void setCtnMsgTempl(CtnMsgTempl ctnMsgTempl) {
		this.ctnMsgTempl = ctnMsgTempl;
	}

	@Column(name = "SEND_USER_ID", nullable = false)
	public Long getSendUserId() {
		return this.sendUserId;
	}

	public void setSendUserId(Long sendUserId) {
		this.sendUserId = sendUserId;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "SEND_DATE", length = 19)
	public Date getSendDate() {
		return this.sendDate;
	}

	public void setSendDate(Date sendDate) {
		this.sendDate = sendDate;
	}

	@Column(name = "STATUS", nullable = false, length = 1)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "ctnUserMsg",cascade=CascadeType.ALL)
	public Set<CtnUserMsgParm> getCtnUserMsgParms() {
		return this.ctnUserMsgParms;
	}

	public void setCtnUserMsgParms(Set<CtnUserMsgParm> ctnUserMsgParms) {
		this.ctnUserMsgParms = ctnUserMsgParms;
	}

}
